#!/bin/bash

rootfs_dir=/home/pbb3/qemu-busybox-test/rootfs-xfce
cross_tool_path=/usr/arm-linux-gnueabihf

Iinclude_dir+=" -I$cross_tool_path/include -I$rootfs_dir/include"

Llibs_dir+=" -L$cross_tool_path/lib -L$rootfs_dir/lib"
Llibs_dir+=" -L$rootfs_dir/lib/glib-2.0"

Llibs+=" -lffi -lgio-2.0 -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lz"

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export CC=${CROSS_COMPILE}gcc

export LDFLAGS=${Llibs_dir}
export LIBS=$Llibs

export PKG_CONFIG_PATH=${rootfs_dir}/lib/pkgconfig:${PKG_CONFIG_PATH}

export EPREFIX=$rootfs_dir
export PREFIX=$rootfs_dir

./configure --host=arm-linux-gnueabihf --prefix=$rootfs_dir \
	--enable-xlib=no \
	--enable-xlib-xrender=no \
	--enable-xcb=no \
	--enable-xlib-xcb=no \
	--enable-xcb-shm=no \
	--enable-qt=no \
	--enable-quartz=no \
	--enable-quartz-font=no \
	--enable-quartz-image=no \
	--enable-win32=no \
	--enable-win32-font=no \
	--enable-os2=no \
	--enable-beos=no \
	--enable-drm=no \
	--enable-gallium=no \
	--enable-png=yes \
	--enable-gl=no \
	--enable-glesv2=no \
	--enable-glesv3=no \
	--enable-cogl=no \
	--enable-directfb=yes \
	--enable-vg=no \
	--enable-egl=no \
	--enable-glx=no \
	--enable-wgl=no \
	--enable-script=no \
	--enable-ft=yes \
	--enable-fc=yes \
	--enable-ps=no \
	--enable-pdf=no \
	--enable-svg=no \
	--enable-test-surfaces=no \
	--enable-tee=no \
	--enable-xml=no \
	--enable-pthread=yes \
	--enable-gobject=yes \
	--enable-trace=no \
	--enable-interpreter=no \
	--enable-symbol-lookup=no \
	--without-x \

make -j64
make -j64 install

unset CC
unset CFLAGS
unset LDFLAGS
unset LIBS
unset CPPFLAGS
unset CPP
unset PKG_CONFIG
unset PKG_CONFIG_PATH
unset PKG_CONFIG_LIBDIR
unset GLIB_CFLAGS
unset GLIB_LIBS
